from flask import Flask
from config import Config
from flask_cors import CORS
#路由
from user.cflask import bp_cbf
from user.admin_user import bp_user
from user.yh import bp_yh


# app = Flask(__name__)

def create_app():
    app = Flask(__name__)
    with app.app_context():
        pass
    return app
app = create_app()

#跨域
CORS(app)
#注册实例
app.config.from_object(Config)


#注册蓝图
app.register_blueprint(bp_cbf,url_prefix='/users')
app.register_blueprint(bp_user,url_prefix='/admin')
app.register_blueprint(bp_yh,url_prefix='/yh')



# from flask_mail import Mail, Message
# mail = Mail(app)
# @app.route('/testmail')
# def testmail():
#     msg = Message('欢迎注册在线教育平台',sender='qq3367812084@163.com',recipients=['lvhualong2021@163.com','qq1143028552@163.com'])#发件人，收件人
#     msg.body = "吕华龙你个小牛马"#输入内容
#     res = mail.send(msg)
#     print(res)
#     return 'ok'



if __name__=='__main__':
    app.run()